﻿using Mengsk.ProxyDelivery.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.App.UI.Delivery
{
    class DeliveryOutPageVM
    {
        public string DeliveryCompany { get; set; }

        public DeliveryOutVM[] Sources { get; set; }

        public string CountInfo
        {
            get
            {
                if (Sources == null || Sources.Length < 1)
                {
                    return "当前共:0条发货记录,0条快递记录";
                }


                return string.Format("当前共:{0}条发货记录,{1}条快递记录", Sources.Length, Sources.Select(obj => obj.Source.DeliveryNumber).Distinct().Count());
            }
        }


        public DeliveryOutPageVM(DeliveryOut[] source, string title)
        {
            this.Sources = source.Select(ob => new DeliveryOutVM(ob)).ToArray();
            this.DeliveryCompany = title;
        }
    }
}
